#include "Test.h"
#include "TestFilter.h"

CPPUNITLITE3_NS_BEGIN;

TestFilter::TestFilter():m_filterString(NULL)
{
}

TestFilter::~TestFilter()
{
    delete []m_filterString;
    m_filterString = NULL;
}

bool TestFilter::setCondition(Condition filterCondition)
{
    if(NULL == filterCondition)
    {
        return true;
    }

    m_filterString = new char[strlen(filterCondition) + 1];
    strcpy(m_filterString, filterCondition);

    return true;
}

bool TestFilter::isFiltered(Test* test)
{
    if(NULL == m_filterString || NULL != strstr(test->getName(), m_filterString))
    {
        return false;
    }
    return true;
}

CPPUNITLITE3_NS_END;

